<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>统计数据页面-首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
    <link rel="stylesheet" href="./css/welcome.css">
</head>

<body>

<div class="containerBox">
            <div class="box blueBox">
                <div class="left">
                    <div class="num"> <span id="userNewAdd">0</span></div>
                    <div> <span>今日用户新增</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-user icon" ></i></div>
            </div>
            <div class="box pinkBox">
                <div class="left">
                    <div class="num"> <span id="todayOrders">0</span></div>
                    <div> <span>今日付款订单</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-form icon" ></i></div>
            </div>
            <div class="box purpleBox">
                <div class="left">
                    <div class="num"> <span id="todayMoney">￥0</span></div>
                    <div> <span>今日付款金额</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-rmb icon" ></i></div>
            </div>
            <div class="box blueBox">
                <div class="left">
                    <div class="num"> <span id="colonelAudit">0</span></div>
                    <div> <span>待审核团长数</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-notice icon" ></i></div>
            </div>
            <div class="box pinkBox">
                <div class="left">
                    <div class="num"> <span id="totalMoney">￥0</span></div>
                    <div> <span>订单总金额</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-rmb icon" ></i></div>
            </div>
            <div class="box purpleBox">
                <div class="left">
                    <div class="num"> <span id="colonelMoney">￥0</span></div>
                    <div> <span>团长总佣金</span></div>
                </div>
                <div class="right"> <i class="layui-icon layui-icon-rmb icon" ></i></div>
            </div>
</div>

<div class="containerInfo">
    `
    <div class="InforStatistics">
        <div class="top"><p>信息统计</p></div>
        <div class="bottom">
            <div class="row" style="padding: 20px;">
                <div class="itemBox">
                    <div class="item">
                        <div class="bottomNum" id="userNum">0</div>
                        <div class="bottomText">用户总数</div>
                    </div>
                    <div class="item">
                        <div class="bottomNum" id="colonelNum">0</div>
                        <div class="bottomText">团长总数</div>
                    </div>
                </div>
                <div class="itemBox">
                    <div class="item">
                        <div class="bottomNum" id="memberNum">0</div>
                        <div class="bottomText">会员总数</div>
                    </div>
                    <div class="item">
                        <div class="bottomNum" id="orderSevenNum">0</div>
                        <div class="bottomText">近七天订单数</div>
                    </div>
                </div>
                <div class="itemBox">
                    <div class="item">
                        <div class="bottomNum" id="goodsNum">0</div>
                        <div class="bottomText">商品总数</div>
                    </div>
                    <div class="item">
                        <div class="bottomNum" id="sevenTurnover">0</div>
                        <div class="bottomText">近7天销售额（元）</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="InforStatistics">
        <div class="top"><p>今日热销</p></div>
        <div class="bottom">
            <table id="data-table" lay-filter="data-table"></table>
        </div>
    </div>`
</div>
<script type="text/html" id="imgtmp">
    <img src="{{d.goodsimg}}" style="width:40px;height: 40px;">
</script>
<script>
    $.ajax({
        type: "GET",
        url: "data/getData",
        success: function (res) {
            console.log(res.data)
            let data = res .data
            $('#userNewAdd').html(data.userNewAdd)
            $('#todayOrders').html(data.todayOrders)
            $('#todayMoney').html("￥"+data.todayMoney)
            $('#colonelAudit').html(data.colonelAudit)
            $('#totalMoney').html("￥"+data.totalMoney)
            $('#colonelMoney').html("￥"+data.colonelMoney)
            $('#userNum').html(data.userNum)
            $('#colonelNum').html(data.colonelNum)
            $('#memberNum').html(data.memberNum)
            $('#orderSevenNum').html(data.orderSevenNum)
            $('#goodsNum').html(data.goodsNum)
            $('#sevenTurnover').html(data.sevenTurnover)
        }
    })

    layui.use(['form','table','laypage','layer'], function() {
        var $ = layui.jquery
            ,form = layui.form,table = layui.table,laypage=layui.laypage,layer=layui.layer;
      table.render({
            elem: "#data-table",
            url: "/goods/getTodayHotGoods",//请求地址
            id:"idTest",
            width:425,
            parseData:function (result){
                return {
                    "code":result.code,
                    "msg":result.msg,
                    "count":result.count,
                    "data":result.data,
                }
            },
            cols: [[
                {field: "goodstitle", title: "商品名称", align: "center",width: 120},
                {field: "goodsimg", title: "图片",width:100, style:"height:40px",align: "center", templet: "#imgtmp"},
                {field: "sales", title: "销量",align: "center",width:80},
                {field: "categoryname", title: "类别",align: "center",width:120}
            ]],
            done:function (res, curr, count) {
                console.log("===============")
                console.log(res)
            },
        });
    })

</script>
</body>

</html>